import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          "文本及样式",
          style: TextStyle(color: Colors.blue,
              fontSize: 40,
              fontWeight: FontWeight.bold,
          ),
        ),
        centerTitle: true,
      ),
      body: Center(child: Column(children: <Widget>[
        Text("HelloWorld" * 20,
            textAlign: TextAlign.left,
            style: TextStyle(
              color: Colors.red,
              fontSize: 20,
              fontWeight: FontWeight.bold,
              fontStyle: FontStyle.italic,
              decoration: TextDecoration.underline,
              decorationColor: Colors.blue,
            )
        ),
        Text("Hello World! I'm Jack" * 4,
          maxLines: 1,
          overflow: TextOverflow.ellipsis,
          style: TextStyle(
            fontSize: 20,
            background: Paint()..color = Colors.cyan,
          ),
        ),
        Text("Hello World! I'm Jack",
          textScaleFactor: 1.5,
        ),
        Text.rich(TextSpan(
          children: [
            TextSpan(text: "Home: ",style: TextStyle(fontSize: 30,color: Colors.red)),
            TextSpan(text: "https://flutter.dev",
              style: TextStyle(color: Colors.blue, fontSize: 30),
              recognizer: TapGestureRecognizer()..onTap = () {
                print("Home page");
              },
            ),
          ],
        ))
      ])),
    );
  }
}
